<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
    <style>
      div {
        position: fixed;
        top: 0;
        bottom: 0;
        left: 0;
        right: 0;
        background-color: rgba(0, 0, 0, 0.5);
        /* display: none; */

        /* display: flex; */
        /* justify-content: center;
        align-items: center; */
      }
      section {
        width: 350px;
        height: 300px;
        background-color: #fff;
        border-radius: 20px;

        /* margin: auto; */

        position: absolute;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        margin: auto;
      }
    </style>
  </head>
  <body>
    <h1>使用固定定位做遮罩</h1>
    <button>btn</button>

    <div>
      <section></section>
    </div>
  </body>
</html>
